package reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Test {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Class cls=Class.forName("reflect.Student");
        Object obj=cls.newInstance();
        System.out.println(obj);

        Constructor constructor= cls.getConstructor(String.class,int.class,char.class);
        Object obj1=constructor.newInstance("张三",21,"男");
        System.out.println(obj1);

    }
}
